#include "scene.h"

Scene::Scene()
{
}

Scene::~Scene()
{
}

void Scene::logicTick()
{
  list<Manager*>::iterator it=m_managers.begin();
  for(;it!=m_managers.end();it++)
    (*it)->logicTick();
}

void Scene::graphicTick()
{
  list<Manager*>::iterator it=m_managers.begin();
  for(;it!=m_managers.end();it++)
    (*it)->graphicTick();
}

bool Scene::hasManager(const type_info& id)
{
  list<Manager*>::iterator it=m_managers.begin();
  for(;it!=m_managers.end();it++)
  {
    if(typeid(*(*it))==id)
      return true;
  }
}

void Scene::addManager(Manager* man)
{
  if(!hasManager(typeid(*man)))
    m_managers.push_back(man);
}

void Scene::removeManager(const type_info& id)
{
  list<Manager*>::iterator it=m_managers.begin();
  for(;it!=m_managers.end();it++)
  {
    if(typeid(*(*it))==id)
    {
      m_managers.erase(it);
      delete *it;
      return;
    }
  }
}
